#pragma once
#include<pthread.h>
#define INF 0
#define DBG 1
#define ERR 2
#define NEW_LV 0

#define LOG(LV, format, ...)\
    do{\
    if(NEW_LV > LV) {break;}\
    time_t t = time(nullptr);\
    struct tm* ltm = localtime(&t);\
    char time_arr[32] = {0};\
    strftime(time_arr, 31, "%F %T", ltm);\
    fprintf(stdout, "[%s %s:%d]" format "\n", time_arr, __FILE__, __LINE__, ##__VA_ARGS__);\
    }while(0)

#define INF_LOG(format, ...) LOG(INF, format, ##__VA_ARGS__)
#define DBG_LOG(format, ...) LOG(DBG, format, ##__VA_ARGS__)
#define ERR_LOG(format, ...) LOG(ERR, format, ##__VA_ARGS__)
// fprintf(stdout, "[%lu %s:%d]" format "\n", (unsigned long)pthread_self(), time_arr, __FILE__, __LINE__, ##__VA_ARGS__);\